﻿/**************************************************************

项目名称 :ThinkWide数据访问基础库
版权所有 (c) 2009 ThinkWide
+-------------------------------------------------------------
项目: 路径类


版本: 1


创建日期:2009-5-3


作者: 章称

+-------------------------------------------------------------
描述:

更新:   2009-5-3

ToDo:

***************************************************************/

using System;
using System.Collections.Generic;
using System.Text;

namespace MF.Core
{

    public class MFPath
    {
        public static string GetAssemblyPath()
        {
            return CheckPath(AppDomain.CurrentDomain.BaseDirectory); 
            
        }

        public static string CheckPath(string sPath)
        {

            if (!sPath.EndsWith("\\"))
                sPath += "\\";
            return sPath;
        }

        public static string GetAssemblyPath(string sFileName)
        {
            return GetAssemblyPath() + sFileName;
        }

        public static string GetRealPath(string sPath)
        {
            if (!sPath.Contains(":"))
            {
                if (AppDomain.CurrentDomain.RelativeSearchPath != null)
                {
                    string appPath = AppDomain.CurrentDomain.RelativeSearchPath;
                    appPath = CheckPath(appPath);
                    return appPath + sPath;
                }
                else
                {
                    string appPath = AppDomain.CurrentDomain.BaseDirectory;
                    appPath = CheckPath(appPath);
                    return appPath+sPath;
                }
            }
            return sPath;
        }




    }

}
